﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WindowsFormsApp1.ui;

namespace WindowsFormsApp1
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        public static TextBox tb;

        private u1 u1;
        private u4 u4;
        private u5 u5;
        private u6 u6;
        private u7 u7;
        private u8 u8;
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            string a = e.Node.Name;
            switch (a)
            {
                case "t2" :

                    this.groupBox1.Controls.Clear();
                    if (u1 == null)
                    {
                        u1 = new ui.u1();
                    }
                    groupBox1.Controls.Add(u1);
                    u1.BringToFront();
                    u1.Focus();
                    break;
                case "t3":
                    this.groupBox1.Controls.Clear();
                    if(u4==null)
                    {
                        u4 = new ui.u4();
                    }
                    groupBox1.Controls.Add(u4);
                    u4.BringToFront();
                    u4.Focus();
                    break;
                case "t4":
                    this.groupBox1.Controls.Clear();
                    if (u5 == null)
                    {
                        u5 = new ui.u5();
                    }
                    groupBox1.Controls.Add(u5);
                    u5.BringToFront();
                    u5.Focus();
                    break;
                case "t5":
                    this.groupBox1.Controls.Clear();
                    if (u6 == null)
                    {
                        u6 = new ui.u6();
                    }
                    groupBox1.Controls.Add(u6);
                    u6.BringToFront();
                    u6.Focus();
                    break;
                case "t6":
                    this.groupBox1.Controls.Clear();
                    if (u7 == null)
                    {
                        u7 = new ui.u7();
                    }
                    groupBox1.Controls.Add(u7);
                    u7.BringToFront();
                    u7.Focus();
                    break;
                case "t7":
                    this.groupBox1.Controls.Clear();
                    if (u8 == null)
                    {
                        u8 = new ui.u8();
                    }
                    groupBox1.Controls.Add(u8);
                    u8.BringToFront();
                    u8.Focus();
                    break;

            }
        }
    }
}

